package com.liu.model;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class VisitDao {
    public void insertById(int blogId, int userId) {
        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        try {
            connection = DBUtil.getConnection();
            String sql = "insert into t_record values (null, ?, ?, now())";
            statement = connection.prepareStatement(sql);
            statement.setInt(1, blogId);
            statement.setInt(2, userId);
            statement.execute();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {
            DBUtil.close(connection, statement, resultSet);
        }
    }

}
